package com.hanoi.wiki.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;


public class BaseObject implements Serializable {
	private static final long serialVersionUID = -5797844976265442577L;
	
	//logical operators
	public static final String GT = ">";
	public static final String GE = ">=";
	public static final String LT = "<";
	public static final String LE = "<=";
	public static final String EQ = "=";
	public static final String NE = "!=";
	public static final String LIKE = " like ";
	public static final String ILIKE = "ilike";
	public static final String ILIKEREST = "ilikerest";
	public static final String NOT_NULL = " is not null ";
	
	public static final String ASCENDING = "asc";
	public static final String DESCENDING = "desc";

	//for pagination
	private long mStartIndex;
	private long mItemsPerPage;
	private long mItemCount;
	
	//properties used for pagination
    private int pageNumber;
    private int pageSize; 
    private String sSearch;
    private String defaultOrder;
    private String defaultSortColumn;
    private String orderField; 
    private String sortDirection;
    
	private Map<String, String> mLogicalOperators = new HashMap<String, String>();
	private Map<String, String> mOrderBy = new LinkedHashMap<String,String>();
	private List<String> mGroupBy = new ArrayList<String>();

	
	/**
	 * @return the pageNumber
	 */
	public int getPageNumber() {
		return pageNumber;
	}

	/**
	 * @return the pageSize
	 */
	public int getPageSize() {
		return pageSize;
	}

	/**
	 * @param pageNumber the pageNumber to set
	 */
	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}

	/**
	 * @param pageSize the pageSize to set
	 */
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public Map<String, String> getLogicalOperators() {
		return mLogicalOperators;
	}

	public Map<String, String> getOrderBy() {
		return mOrderBy;
	}
	
	
	public List<String> getGroupBy() {
		return mGroupBy;
	}

	/**
	 * @return the startIndex
	 */
	public long getStartIndex() {
		return mStartIndex;
	}

	/**
	 * @param startIndex the startIndex to set
	 */
	public void setStartIndex(long startIndex) {
		mStartIndex = startIndex;
	}

	/**
	 * @return the itemsPerPage
	 */
	public long getItemsPerPage() {
		return mItemsPerPage;
	}

	/**
	 * @param itemsPerPage the itemsPerPage to set
	 */
	public void setItemsPerPage(long itemsPerPage) {
		mItemsPerPage = itemsPerPage;
	}

	/**
	 * @return the itemCount
	 */
	public long getItemCount() {
		return mItemCount;
	}

	/**
	 * @param itemCount the itemCount to set
	 */
	public void setItemCount(long itemCount) {
		mItemCount = itemCount;
	}

	/**
	 * @return the sSearch
	 */
	public String getsSearch() {
		return sSearch;
	}

	/**
	 * @param sSearch the sSearch to set
	 */
	public void setsSearch(String sSearch) {
		this.sSearch = sSearch;
	}

	/**
	 * @return the defaultOrder
	 */
	public String getDefaultOrder() {
		return defaultOrder;
	}

	/**
	 * @return the defaultSortColumn
	 */
	public String getDefaultSortColumn() {
		return defaultSortColumn;
	}

	/**
	 * @param defaultOrder the defaultOrder to set
	 */
	public void setDefaultOrder(String defaultOrder) {
		this.defaultOrder = defaultOrder;
	}

	/**
	 * @param defaultSortColumn the defaultSortColumn to set
	 */
	public void setDefaultSortColumn(String defaultSortColumn) {
		this.defaultSortColumn = defaultSortColumn;
	}

	/**
	 * @return the orderField
	 */
	public String getOrderField() {
		return orderField;
	}

	/**
	 * @return the sortDirection
	 */
	public String getSortDirection() {
		return sortDirection;
	}

	/**
	 * @param orderField the orderField to set
	 */
	public void setOrderField(String orderField) {
		this.orderField = orderField;
	}

	/**
	 * @param sortDirection the sortDirection to set
	 */
	public void setSortDirection(String sortDirection) {
		this.sortDirection = sortDirection;
	}
}
